home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Information / Digests / CSMP Digest / volume 1 / csmp-v1-215.txt < prev    next >
Encoding:
Text File  |  1994-12-08  |  36.9 KB  |  1,050 lines  |  [TEXT/R*ch]

  1. C.S.M.P. Digest             Thu, 19 Nov 92       Volume 1 : Issue 215
  2.  
  3. Today's Topics:
  4.  
  5.     Event Manager Too Slow or izzit just me?
  6.     Dynamic Change of Mouse Tracking Speed
  7.     Anyone use SoftPolish?
  8.     DisposeHandle vs. ReleaseResource
  9.     Forcing TextEdit to set scrpAscent and scrpHeight
  10.     Forcing Sys6 on a Q700?
  11.  
  12.  
  13.  
  14. The Comp.Sys.Mac.Programmer Digest is moderated by Michael A. Kelly.
  15.  
  16. The digest is a collection of article threads from the internet newsgroup
  17. comp.sys.mac.programmer.  It is designed for people who read c.s.m.p. semi-
  18. regularly and want an archive of the discussions.  If you don't know what a
  19. newsgroup is, you probably don't have access to it.  Ask your systems
  20. administrator(s) for details.  You can post articles to any newsgroup by
  21. mailing your article to newsgroup@ucbvax.berkeley.edu.  So, to post an
  22. article to comp.sys.mac.programmer, you mail it to
  23. comp-sys-mac-programmer@ucbvax.berkeley.edu.  Note the '-' instead of '.'
  24. in the newsgroup name.
  25.  
  26. Each issue of the digest contains one or more sets of articles (called
  27. threads), with each set corresponding to a 'discussion' of a particular
  28. subject.  The articles are not edited; all articles included in this digest
  29. are in their original posted form (as received by our news server at
  30. cs.uoregon.edu).  Article threads are not added to the digest until the last
  31. article added to the thread is at least one month old (this is to ensure that
  32. the thread is dead before adding it to the digest).  Article threads that
  33. consist of only one message are generally not included in the digest.
  34.  
  35. The entire digest is available for anonymous ftp from ftp.cs.uoregon.edu
  36. [128.223.8.8] in the directory /pub/mac/csmp-digest.  Be sure to read the
  37. file /pub/mac/csmp-digest/README before downloading any files.  The most
  38. recent issues are available from sumex-aim.stanford.edu [36.44.0.6] in the
  39. directory /info-mac/digest/csmp.  If you don't have ftp capability, the sumex
  40. archive has a mail server; send a message with the text '$MACarch help' (no
  41. quotes) to LISTSERV@ricevm1.rice.edu for more information.
  42.  
  43. The digest is also available via email.  Just send a note saying that you
  44. want to be on the digest mailing list to mkelly@cs.uoregon.edu, and you will
  45. automatically receive each new issue as it is created.  Sorry, back issues
  46. are not available through the mailing list.
  47.  
  48. Send administrative mail to mkelly@cs.uoregon.edu.
  49.  
  50.  
  51. -------------------------------------------------------
  52.  
  53. From: wwg2101@venus.tamu.edu (GILPIN, W.W.)
  54. Subject: Event Manager Too Slow or izzit just me?
  55. Organization: Texas A&M University, Academic Computing Services
  56. Date: Tue, 13 Oct 1992 04:49:00 GMT
  57.  
  58. Here is some code from a little game thingy that I'm writing. It's part
  59. of the event loop I'm using for when the game is actually being played. The
  60. idea is that the little ship moves around on the screen and the player can
  61. control whether it moves up, down, left or right. From the discussion here
  62. I was expecting flicker problems but I haven't really experienced any of those.
  63. (yet...knock on wood)
  64.  
  65. The problem I *am* having, though, is the movement is jumpy. I've traced
  66. the jumpiness to this code:
  67.  
  68.     while (! gameDone)
  69.     {
  70.         if (gWNEImplemented)
  71.             WaitNextEvent(everyEvent, &gTheEvent, SLEEP, 
  72.                 NIL_MOUSE_REGION);
  73.         else
  74.         {
  75.             SystemTask();
  76.             GetNextEvent(everyEvent, &gTheEvent);
  77.         }
  78.         if (gTheEvent.what == keyDown)
  79.             gameDone = HandleGameKey(&newDirection);
  80.         .
  81.         .
  82.     (move the ship and/or change directions)
  83.         .
  84.         .
  85.      }
  86.  
  87. Note:
  88. #define SLEEP            0L
  89. #define NIL_MOUSE_REGION 0L
  90.  
  91.  
  92. Without this code the ship moves smooth as glass...but I can't control it,
  93. which doesn't help. I've tried just using keyDownMask instead of everyEvent but
  94. that didn't help either. My questions are (1) Is there something I'm doing
  95. wrong or something missing that should be painfully obvious? and (2) Is there
  96. a faster way of getting keyboard input?
  97.  
  98. If I left anything out that would make the problem easier to slove lemme 
  99. know...
  100.  
  101. Thanx
  102. - -------------------------------------------------------------------------------
  103. | Wes Gilpin              | I'd kill myself for you...I'd kill you for myself |
  104. | WWG2101@TAMZEUS(BITNet) |------------------------------------------         |
  105. | WWG2101@ZEUS.TAMU.EDU   | Southwest Knights of Nee Paintball Team | PANTERA |
  106. - -------------------------------------------------------------------------------
  107.  
  108. +++++++++++++++++++++++++++
  109.  
  110. Date: 13 Oct 92 09:50:12 GMT
  111. Organization: Royal Institute of Technology, Stockholm, Sweden
  112.  
  113. > wwg2101@venus.tamu.edu (GILPIN, W.W.) writes:
  114.  
  115.    The problem I *am* having, though, is the movement is jumpy. I've traced
  116.    the jumpiness to this code:
  117.  
  118.            if (gWNEImplemented)
  119.                WaitNextEvent(everyEvent, &gTheEvent, SLEEP, 
  120.                    NIL_MOUSE_REGION);
  121.            else
  122.            {
  123.                SystemTask();
  124.                GetNextEvent(everyEvent, &gTheEvent);
  125.            }
  126.  
  127.  
  128. Okay, why are you checking for WaitNextEvent? Want to run
  129. under system 4.2 without MultiFinder? WaitNextEvent is ALWAYS
  130. implemented if
  131. 1) you run system 6.0 or higher
  132. or
  133. 2) you run MultiFInder
  134.  
  135. I did away with checking a LOOOONG time ago. (Now, people, what's
  136. a good way of checking for MultiFinder? :-) :-) :-)
  137.  
  138.            if (gTheEvent.what == keyDown)
  139.                gameDone = HandleGameKey(&newDirection);
  140.            .
  141.  
  142. You inline the event handling dispatching. That's bad style,
  143. because if you call WaitNextEvent some other place, or get an
  144. update event within a filterProc, you want to handle that event
  145. using your normal event handling functions.
  146.  
  147. Separate out the dispatching (and use a switch for chrissake :-)
  148. into a HandleEvent ( EventRecord * event ) function instead.
  149.  
  150. Now, about your jerkyness problem; you'll lose background tasking
  151. one way or the other:
  152.  
  153. 1) System 6 way:
  154.     Call GetOSEvent instead of WaitNextEvent. This will totally
  155.     freeze up all background tasks, but will yield snappy
  156.     performance for you. Update events and other such unimportant
  157.     stuff won't get in your way, and clicks outside your window
  158.     won't switch you out.
  159. 2) System 7 way:
  160.     Ask the user "Would you like jerky motion and living processes,
  161.     or should I kill the f*cking cycle-stealers ?"
  162.     Then, if the user opts for violence, use the process manager
  163.     to kill off all tasks except yourself. WaitNextEvent should
  164.     be snappy enough after that.
  165.  
  166. Hope this helps,
  167.  
  168. - -- 
  169.  -- Jon W{tte, h+@nada.kth.se, Mac Hacker Suedoise (not french speaking) --
  170.  
  171.    There's no problem that can't be solved using brute-force algorithms
  172.    and a sufficiently fast computer. Ergo, buy more hardware.
  173.  
  174. +++++++++++++++++++++++++++
  175.  
  176. From: scott@mcl.ucsb.edu (Scott Bronson)
  177. Date: 13 Oct 92 18:11:39 GMT
  178.  
  179. In <D88-JWA.92Oct13105012@byse.nada.kth.se> d88-jwa@byse.nada.kth.se (Jon Wtte) writes:
  180.  
  181. >> wwg2101@venus.tamu.edu (GILPIN, W.W.) writes:
  182.  
  183. >Okay, why are you checking for WaitNextEvent? Want to run
  184. >under system 4.2 without MultiFinder? WaitNextEvent is ALWAYS
  185. >implemented if
  186. >1) you run system 6.0 or higher
  187. >or
  188. >2) you run MultiFInder
  189.  
  190. Hey, I still check simply because it takes no time, is not hard at
  191. all, and I don't really like leaping off unimplemented traps if the
  192. user is running under an insufficient system.  But, that's not the
  193. purpose of this followup.
  194.  
  195.  
  196. >1) System 6 way: GetOSEvent.
  197. >2) System 7 way: Kill all apps but me.
  198.  
  199. Or, finally, a technique that works under all systems that I know
  200. of: don't use an event loop.  Simply use GetKeys and Button to
  201. figure out what you want to do.  This gives absolutely no time
  202. to anyone else, so you'll cause modem programs to overflow buffers
  203. and wreak all kinds of havoc, but your game will be as smooth as
  204. silk.  I may catch flak for this for some reason, but it has worked
  205. for me.
  206.  
  207.     - Scott
  208.  
  209. +++++++++++++++++++++++++++
  210.  
  211. From: k044477@hobbes.kzoo.edu (Jamie R. McCarthy)
  212. Organization: Kalamazoo College
  213. Date: Tue, 13 Oct 1992 19:48:21 GMT
  214.  
  215. scott@mcl.ucsb.edu (Scott Bronson) writes:
  216. >d88-jwa@byse.nada.kth.se (Jon Wtte) writes:
  217. >>
  218. >>Okay, why are you checking for WaitNextEvent?
  219. >
  220. >Hey, I still check simply because it takes no time,
  221.  
  222. You are obviously using a meaning of the word "no" with which I am
  223. not familiar.  :-)
  224.  
  225. >>1) System 6 way: GetOSEvent.
  226. >>2) System 7 way: Kill all apps but me.
  227. >
  228. >Or, finally, a technique that works under all systems that I know
  229. >of: don't use an event loop.  Simply use GetKeys and Button...
  230.  
  231. Allow me to provide the obligatory reminder to anyone who's going to do
  232. this:  it's considered polite to inform the user that you're deactivating
  233. the rest of her computer.  I suggest a notice on a splash screen or
  234. options screen, something like:  "To obtain maximum smoothness, this
  235. arcade game will temporarily stop the rest of the computer.  For
  236. example, file sharing and modem transfers will not work while the game
  237. is in play." (This suitably-newbie message should suffice both for games
  238. that don't give time, and for games that kill all other processes, I
  239. think.)
  240. - -- 
  241.  Jamie McCarthy      Internet: k044477@kzoo.edu      AppleLink: j.mccarthy
  242.  "Magic Johnson says he attended two scheduled meetings [of] the president's
  243.   AIDS commission, one more than Mr. Bush credited him with during Sunday's
  244.   debate [and] one more than any of the three members of the Bush cabinet..."
  245.  
  246. +++++++++++++++++++++++++++
  247.  
  248. From: REEKES@applelink.apple.com (Jim Reekes)
  249. Date: 13 Oct 92 19:57:15 GMT
  250. Organization: Apple Computer, Inc.
  251.  
  252. In article <D88-JWA.92Oct13105012@byse.nada.kth.se>,
  253. d88-jwa@byse.nada.kth.se (Jon Wtte) wrote:
  254. > > wwg2101@venus.tamu.edu (GILPIN, W.W.) writes:
  255. >    The problem I *am* having, though, is the movement is jumpy. I've traced
  256. >    the jumpiness to this code:
  257. >            if (gWNEImplemented)
  258. >                WaitNextEvent(everyEvent, &gTheEvent, SLEEP, 
  259. >                    NIL_MOUSE_REGION);
  260. >            else
  261. >            {
  262. >                SystemTask();
  263. >                GetNextEvent(everyEvent, &gTheEvent);
  264. >            }
  265. > [ some stuff deleted ]
  266. > Now, about your jerkyness problem; you'll lose background tasking
  267. > one way or the other:
  268. > 1) System 6 way:
  269. >     Call GetOSEvent instead of WaitNextEvent. This will totally
  270. >     freeze up all background tasks, but will yield snappy
  271. >     performance for you. Update events and other such unimportant
  272. >     stuff won't get in your way, and clicks outside your window
  273. >     won't switch you out.
  274. > 2) System 7 way:
  275. >     Ask the user "Would you like jerky motion and living processes,
  276. >     or should I kill the f*cking cycle-stealers ?"
  277. >     Then, if the user opts for violence, use the process manager
  278. >     to kill off all tasks except yourself. WaitNextEvent should
  279. >     be snappy enough after that.
  280.  
  281. I'd like to point out at this time that while some developers want this,
  282. others are asking Apple for pre-emptive multitasking.  The above would not
  283. be possible with a pre-emptive OS.  Now, personally I'm not in favor of
  284. having pre-emptive OS on my personal computer.  I just have to point out
  285. that one cannot have it both ways.  The above idea is a strong argument in
  286. favor of not using a pre-emptive OS.
  287.  
  288. - -----------------------------------------------------------------------
  289. Jim Reekes, Polterzeitgeist  |     Macintosh Toolbox Engineering
  290.                              |          Sound Manager Expert
  291. Apple Computer, Inc.         | RAll opinions expressed are mine, and do
  292. 20525 Mariani Ave. MS: 81-KS |   not necessarily represent those of my
  293. Cupertino, CA 95014          |       employer, Apple Computer Inc.S
  294.  
  295. +++++++++++++++++++++++++++
  296.  
  297. From: wwg2101@venus.tamu.edu (GILPIN, W.W.)
  298. Organization: Texas A&M University, Academic Computing Services
  299. Date: Tue, 13 Oct 1992 13:17:00 GMT
  300.  
  301. >Okay, why are you checking for WaitNextEvent? Want to run
  302. >under system 4.2 without MultiFinder? WaitNextEvent is ALWAYS
  303.  
  304. Never underestimate a business major!  :) :) That's not where the slow down is
  305. anyway. I tried it without checking and just using WNE too.
  306.  
  307. >           if (gTheEvent.what == keyDown)
  308. >               gameDone = HandleGameKey(&newDirection);
  309. >You inline the event handling dispatching. That's bad style,
  310. >because if you call WaitNextEvent some other place, or get an
  311. >update event within a filterProc, you want to handle that event
  312. >using your normal event handling functions.
  313.  
  314. >Separate out the dispatching (and use a switch for chrissake :-)
  315. >into a HandleEvent ( EventRecord * event ) function instead.
  316.  
  317. Okay, I feel the need to defend myself here cause I'm not always this sloppy.
  318. I wrote this code quick and dirty and since right now the only thing I'm 
  319. interested in is the 4 keydowns for the direction of the player and the 1 
  320. other keydown for stopping the game. I just wanted to see if I could get the
  321. bugger to move around on the screen, dontchaknow? :)  My other event loop
  322. for when the game ain't runnin' has a nice big switch right where it 
  323. should be.
  324.  
  325. >Now, about your jerkyness problem; you'll lose background tasking
  326. >one way or the other:
  327.  
  328. Not a problem.
  329.  
  330. >1) System 6 way:
  331. .
  332. .
  333. >2) System 7 way:
  334. .
  335. .
  336. >Hope this helps,
  337.  
  338. Most definately! Thanks!
  339.  
  340. - -------------------------------------------------------------------------------
  341. | Wes Gilpin              | I'd kill myself for you...I'd kill you for myself |
  342. | WWG2101@TAMZEUS(BITNet) |------------------------------------------         |
  343. | WWG2101@ZEUS.TAMU.EDU   | Southwest Knights of Nee Paintball Team | PANTERA |
  344. - -------------------------------------------------------------------------------
  345.  
  346. +++++++++++++++++++++++++++
  347.  
  348. From: de19@umail.umd.edu (Dana S Emery)
  349. Date: 15 Oct 92 11:15:51 GMT
  350. Organization: Personal
  351.  
  352. In article <REEKES-131092125541@90.10.20.67>, REEKES@applelink.apple.com
  353. (Jim Reekes) wrote:
  354. > In article <D88-JWA.92Oct13105012@byse.nada.kth.se>,
  355. > d88-jwa@byse.nada.kth.se (Jon Wtte) wrote:
  356. > > [ some stuff deleted ]
  357. > > 
  358. > > 1) System 6 way:
  359. > >     Call GetOSEvent instead of WaitNextEvent. This will totally
  360. > >     freeze up all background tasks, but will yield snappy
  361. > >     performance for you. Update events and other such unimportant
  362. > >     stuff won't get in your way, and clicks outside your window
  363. > >     won't switch you out.
  364. > > 2) System 7 way:
  365. > >     Ask the user "Would you like jerky motion and living processes,
  366. > >     or should I kill the f*cking cycle-stealers ?"
  367. > >     Then, if the user opts for violence, use the process manager
  368. > >     to kill off all tasks except yourself. WaitNextEvent should
  369. > >     be snappy enough after that.
  370.  
  371. How about the Miss Manners way?  check for ongoing processes, and refuse to
  372. torpedo the user untill the machine is clean (7), or is prounced clean (6,
  373. - - ).  This will force the user to recognize what the machine state really
  374. *is*, rather than what she *thinks* it is, and will allow an orderly USER
  375. CONTROLLED shutdown of possibly interdependant processes.
  376. - --
  377.  
  378. Dana S Emery <de19@umail.umd.edu> | "Novo, de Novo,
  379.                                   |     de novo, de no-o-o-o-o---, 
  380.                                   | Novemba come an' dey gonna go home."
  381.  
  382. +++++++++++++++++++++++++++
  383.  
  384. Date: 16 Oct 92 11:59:13 GMT
  385. Organization: Royal Institute of Technology, Stockholm, Sweden
  386.  
  387. > de19@umail.umd.edu (Dana S Emery) writes:
  388.  
  389.    > >     Ask the user "Would you like jerky motion and living processes,
  390.         ~~~~~~~~~~~~
  391.  
  392.    *is*, rather than what she *thinks* it is, and will allow an orderly USER
  393.    CONTROLLED shutdown of possibly interdependant processes.
  394.  
  395. Maybe one could add a list of processes to the question,
  396. but as long as the question has a "don't kill" button,
  397. it's a user-in-control situatino.
  398.  
  399. After all, if the user is unaware of that 400k dissertation
  400. in that hidden Word window, does he/she need it? :-)
  401.  
  402. - -- 
  403.  -- Jon W{tte, h+@nada.kth.se, Mac Hacker Suedoise (not french speaking) --
  404.   _/~|   Yellow
  405.  / * \_  Shark                      (This signature has won the "Worst ASCII
  406.  ~~~~\/  Software                    Logo of the Year" award)
  407.  
  408. ---------------------------
  409.  
  410. From: ralex@tigger.cs.Colorado.EDU (Repenning Alexander)
  411. Subject: Dynamic Change of Mouse Tracking Speed
  412. Date: 13 Oct 92 19:30:09 GMT
  413. Organization: University of Colorado, Boulder
  414.  
  415.  
  416. I am dealing with the visual representation of complex data structures.
  417. I like to experiment with the Mouse Tracking Speed to make it easier
  418. for users to track on important information: "soft snapping".
  419.  
  420. Is there some simple way to change the mouse tracking speed (e.g. via
  421. a trap)?  What I need is a function allowing me to adjust mouse
  422. tracking to speeds like the ones avaivable in the MOUSE CDEV (very
  423. slow, .., fast). How is the MOUSE CDEV doing it?
  424.  
  425. Any ideas, clues?
  426.  
  427.   Thanks,  Alex
  428.  
  429. +++++++++++++++++++++++++++
  430.  
  431. From: thepope@bigboy (Michael Kohne)
  432. Date: 15 Oct 92 00:27:33 GMT
  433. Organization: Temple University
  434.  
  435. ralex@tigger.cs.Colorado.EDU (Repenning Alexander) writes:
  436. : I am dealing with the visual representation of complex data structures.
  437. : I like to experiment with the Mouse Tracking Speed to make it easier
  438. : for users to track on important information: "soft snapping".
  439. : Is there some simple way to change the mouse tracking speed (e.g. via
  440. : a trap)?  What I need is a function allowing me to adjust mouse
  441. : tracking to speeds like the ones avaivable in the MOUSE CDEV (very
  442. : slow, .., fast). How is the MOUSE CDEV doing it?
  443. : Any ideas, clues?
  444. :   Thanks,  Alex
  445.  
  446. I don't know how to change the mouse tracking speed, but I do know that it is
  447. more complex than 1 number. If you can find someone with a Kensington Turbo
  448. Mouse, and the Turbo Mouse control panel, have them show you the 'custom' 
  449. settings. Basically, the mouse tracking speed is a series of 8 thresholds
  450. that tell the system how to repond to mouse movements of varying lengths and
  451. speeds. I don't know where these numbers reside in memory during run-time,
  452. however. It may be that you could simply use macsbug to figure out what 
  453. resource the Mouse Control panel is messing with in the system.
  454.  
  455. "Pope" Q.E.D
  456. Michael Kohne
  457. thepope@bigboy.cis.temple.edu
  458. House of the Techno-Discordians, Archery Amusements Division
  459. <twang!>
  460.  
  461. +++++++++++++++++++++++++++
  462.  
  463. From: jmatthews@desire.wright.edu
  464. Date: 16 Oct 92 07:16:10 GMT
  465. Organization: Wright State University
  466.  
  467. > ralex@tigger.cs.Colorado.EDU (Repenning Alexander) writes:
  468. > : 
  469. > : I am dealing with the visual representation of complex data structures.
  470. > : I like to experiment with the Mouse Tracking Speed to make it easier
  471. > : for users to track on important information: "soft snapping".
  472. > : 
  473. > : Is there some simple way to change the mouse tracking speed (e.g. via
  474. > : a trap)?  What I need is a function allowing me to adjust mouse
  475. > : tracking to speeds like the ones avaivable in the MOUSE CDEV (very
  476. > : slow, .., fast). How is the MOUSE CDEV doing it?
  477. > : 
  478. > : Any ideas, clues?
  479.  
  480. Alley & Strange, _ResEdit Complete_, from the Macintosh Inside Out series,
  481. discusses mouse thresholds stored in 'mcky' resources. There's a nice
  482. explanation of what the values mean, but nothing about how to change
  483. them on the fly (except to edit the active system file and touch the
  484. control panel).
  485.  
  486. I notice that booting System 5.1 messes up mouse tracking, as does the
  487. return to System 7 after fixing it in 5.1. I'm going to go out on a limb
  488. here and speculate that mouse tracking is system dependent.
  489.  
  490. After many folks begged to be able to change screen depth on the fly,
  491. DTS produced HasDepth and SetDepth. I wonder if something analogous
  492. for mouse tracking might be possible.
  493.  
  494. o----------------------------------------------------------------------------o
  495. | John B. Matthews, jmatthews@desire.wright.edu, disclaimer:= myViews <> WSU |
  496. |      "Whom the gods would destroy, they first invite to program in C"      |
  497. o----------------------------------------------------------------------------o
  498.  
  499. ---------------------------
  500.  
  501. From: haynes@mace.cc.purdue.edu (Carl W. Haynes III)
  502. Subject: Anyone use SoftPolish?
  503. Organization: Purdue University
  504. Date: Fri, 16 Oct 1992 17:46:20 GMT
  505.  
  506.  
  507.  
  508. I've been thinking about purchasing SoftPolish, but have never
  509. seen any comments about it.
  510.  
  511. Has anyone used it? I'd be interested in any comments, especially:
  512.  
  513. 1) Is the dictionary customizable (can I add entries?)
  514. 2) Can you spell check only part of a resource?, I have a number
  515.    of resources that are part text and part bitmap.
  516. 3) Is it generally easy to use, do you get lots of useless
  517.    comments about your resources?
  518. 4) Can you specify which resource types to check (i.e. check
  519.    some but not others?
  520.  
  521. As you can see, I'm mainly interested in the spell checking part of
  522. it. So any comments about that aspect are especially appreciated.
  523.  
  524. carl
  525.  
  526.  
  527. - --
  528. Carl W. Haynes III             ||  "She'll see through me like Grandma's
  529. Buddy can you spare a job?     ||   underpants." 
  530. haynes@mace.cc.purdue.edu      ||                  -- Bart Simpson
  531. hcs@applelink.apple.com        ||  
  532.  
  533.  
  534. +++++++++++++++++++++++++++
  535.  
  536. From: blob@gallant.apple.com (Brian Bechtel)
  537. Date: Fri, 16 Oct 1992 21:35:07 GMT
  538. Organization: Apple Computer Inc.
  539.  
  540. haynes@mace.cc.purdue.edu (Carl W. Haynes III) writes:
  541.  
  542. >I've been thinking about purchasing SoftPolish, but have never
  543. >seen any comments about it.
  544.  
  545. >1) Is the dictionary customizable (can I add entries?)
  546.  
  547. Yes.
  548.  
  549. >2) Can you spell check only part of a resource?, I have a number
  550. >   of resources that are part text and part bitmap.
  551.  
  552. >3) Is it generally easy to use, do you get lots of useless
  553. >   comments about your resources?
  554.  
  555. You set the level of comments you want to receive.
  556.  
  557. >4) Can you specify which resource types to check (i.e. check
  558. >   some but not others?
  559.  
  560. Yes.
  561.  
  562. In general, this is a WONDERFUL product.  It polishes up your grammar
  563. and spelling.  It checks for resource validity.  It checks for missing
  564. parts of a set of resources (e.g. DLOG without a DITL, DITL without a
  565. DLOG.)  It does a lot more.
  566.  
  567. For more information, send a message to langsys@appplelink.apple.com or
  568. call them at (703) 478-0181.
  569.  
  570. - --Brian Bechtel     blob@apple.com     "My opinion, not Apple's"
  571.  
  572.  
  573. ---------------------------
  574.  
  575. From: system@asuvax.eas.asu.edu (Marc Lesure)
  576. Subject: DisposeHandle vs. ReleaseResource
  577. Organization: Arizona State University
  578. Date: Thu, 15 Oct 1992 20:20:20 GMT
  579.  
  580. I have a routine that deletes, adds, and updates a resource in a
  581. preference file.  The function performs what it is suppose to do, however
  582. it doesn't seem to release the memory (if I call the routine enough times,
  583. it dies with a dsMemFullErr).  I understand that you need to use
  584. ReleaseResource(), if the allocated handle came from GetResource().  But
  585. what if the handle is created via a NewHandle() call?
  586.  
  587. Here is the snippet:
  588.  
  589. writePrefs(void)
  590. {
  591.     Handle        aH;    
  592.     int        resFile,tmpResFile;
  593.     
  594.     tmpResFile = CurResFile();
  595.     resFile = openPrefs();
  596.     UseResFile(resFile);
  597.  
  598. /* delete old resource */
  599.     aH = Get1Resource(TYPE, baseID);
  600.     if (aH != NIL)
  601.     {
  602.         RmveResource(aH);
  603.         UpdateResFile(resFile);
  604.         ReleaseResource(aH);
  605.         aH = NIL;
  606.     }
  607.  
  608. /* add new resource */
  609.     if (aH == NIL)
  610.     {
  611.         aH = NewHandle(...);
  612.         if (aH == NIL)
  613.             return;
  614.         AddResource(aH, TYPE, baseID, NAME);
  615.     }
  616.     
  617. /* update resource */
  618.     if (ResError() == noErr)
  619.     {
  620.         HLock(aH);
  621.         ... fill handle ...
  622.         HUnlock(aH);
  623.             
  624.         ChangedResource(aH);
  625.         WriteResource(aH);
  626.     }
  627.  
  628.     ReleaseResource(aH); /* or DisposeHandle or Both? */
  629.  
  630.     UseResFile(tmpResFile);
  631.     CloseResFile(resFile);
  632. }
  633.  
  634. - -----------------------------------------------------------------------
  635. Marc Lesure / Arizona State University / Tempe, AZ
  636. "Between the world of men and make-believe, I can be found..."
  637. "False faces and meaningless chases, I travel alone..."
  638. "And where do you go when you come to the end of your dream?"
  639.  
  640. UUCP:       ...!ncar!noao!asuvax!lesure  
  641. Internet:   lesure@asuvax.eas.asu.edu
  642.  
  643. +++++++++++++++++++++++++++
  644.  
  645. From: marshall@sdd.hp.com (Marshall Clow)
  646. Date: 15 Oct 92 20:55:45 GMT
  647. Organization: Hewlett Packard San Diego Printer Division
  648.  
  649. In article <1992Oct15.202020.17123@asuvax.eas.asu.edu>,
  650. system@asuvax.eas.asu.edu (Marc Lesure) wrote:
  651. > I have a routine that deletes, adds, and updates a resource in a
  652. > preference file.  The function performs what it is suppose to do, however
  653. > it doesn't seem to release the memory (if I call the routine enough times,
  654. > it dies with a dsMemFullErr).  I understand that you need to use
  655. > ReleaseResource(), if the allocated handle came from GetResource().  But
  656. > what if the handle is created via a NewHandle() call?
  657. > [ code deleted ]
  658.  
  659. Rule of thumb: If a handle refers to a resource, then use ReleaseResource. 
  660. If it doesn't, then use DisposHandle. It doesn't matter how it was created.
  661.  
  662. DetachResource and RmveResource turn resource handles into a 
  663. non-resource handle. AddResource turns a non-resource handle into a 
  664. resource handle.
  665.  
  666. Even bigger rule of thumb: Check for errors!!!
  667.  
  668. Here lies one problem in your code:
  669. >        RmveResource(aH);
  670. >     UpdateResFile(resFile);
  671. >     ReleaseResource(aH);
  672. ReleaseResource does nothing if aH is not a handle to a resource.
  673. ResError will tell you this. (See rule #2)
  674.  
  675.  
  676. Marshall Clow
  677. San Diego Printer Division      Hewlett Packard
  678. Internet: marshall@sdd.hp.com   AppleLink: HP.Marshall    AOL: MClow
  679.  
  680. +++++++++++++++++++++++++++
  681.  
  682. From: thepope@bigboy (Michael Kohne)
  683. Date: 15 Oct 92 23:38:59 GMT
  684. Organization: House of the Techno-Discordians
  685.  
  686.  
  687. system@asuvax.eas.asu.edu (Marc Lesure) writes:
  688. : I have a routine that deletes, adds, and updates a resource in a
  689. : preference file.  The function performs what it is suppose to do, however
  690. : it doesn't seem to release the memory (if I call the routine enough times,
  691. : it dies with a dsMemFullErr).  I understand that you need to use
  692. : ReleaseResource(), if the allocated handle came from GetResource().  But
  693. : what if the handle is created via a NewHandle() call?
  694. :
  695. <Some code deleted> 
  696. : /* add new resource */
  697. :     if (aH == NIL)
  698. :     {
  699. :         aH = NewHandle(...);
  700. :         if (aH == NIL)
  701. :             return;
  702. :         AddResource(aH, TYPE, baseID, NAME);
  703. At this point you will need to ReleaseResource. I always do a ChangedResource,
  704. then a WriteResource first, but the ChangedResource might not be necessary.
  705. :     }
  706.      
  707. : -----------------------------------------------------------------------
  708. : Marc Lesure / Arizona State University / Tempe, AZ
  709. : "Between the world of men and make-believe, I can be found..."
  710. : "False faces and meaningless chases, I travel alone..."
  711. : "And where do you go when you come to the end of your dream?"
  712. : UUCP:       ...!ncar!noao!asuvax!lesure  
  713. : Internet:   lesure@asuvax.eas.asu.edu
  714.  
  715. Michael Kohne
  716. thepope@bigboy.cis.temple.edu
  717. House of the Techno-Discorians, Ammunition Amusements Division
  718. <bang!>
  719.  
  720. +++++++++++++++++++++++++++
  721.  
  722. From: ivanski@world.std.com (Ivan M CaveroBelaunde)
  723. Organization: The World Public Access UNIX, Brookline, MA
  724. Date: Fri, 16 Oct 1992 04:13:33 GMT
  725.  
  726. system@asuvax.eas.asu.edu (Marc Lesure) writes:
  727.  
  728. >I have a routine that deletes, adds, and updates a resource in a
  729. >preference file.  The function performs what it is suppose to do, however
  730. >it doesn't seem to release the memory (if I call the routine enough times,
  731. >it dies with a dsMemFullErr).  I understand that you need to use
  732. >ReleaseResource(), if the allocated handle came from GetResource().  But
  733. >what if the handle is created via a NewHandle() call?
  734.  
  735. Couple of problems here.  First of all, you don't need to call
  736. ReleaseResource if you've removed it already from your resource map.
  737. In fact, ReleaseResource will do nothing. Thus you need to call
  738. DisposHandle.
  739.  
  740. Second, just to be on the safe side, you probably should SetResLoad(false)
  741. before getting the resource you're removing. Otherwise you might get
  742. NIL back from Get1Resource, not because it didn't find it, but because it
  743. could not be loaded into memory.  If this happens, then you won't be
  744. able to perform the AddResource properly (in fact, you'll end up with
  745. two resources with the same type and ID in that file - a BAD thing).
  746. Don't forget to SetResLoad(true) immediately after the Get1Resource.
  747.  
  748. >/* delete old resource */
  749.     SetResLoad(false);
  750. >    aH = Get1Resource(TYPE, baseID);
  751.     SetResLoad(true);
  752. >    if (aH != NIL)
  753. >    {
  754. >        RmveResource(aH);
  755. >        UpdateResFile(resFile);
  756.         DisposHandle(aH);
  757.     /*    Do even if aH points to a purged handle to free the
  758.         master pointer.    */
  759. /*    Comment out
  760. >        ReleaseResource(aH);
  761. */
  762. >        aH = NIL;
  763. >    }
  764.  
  765. >/* add new resource */
  766. >    if (aH == NIL)
  767. >    {
  768. >        aH = NewHandle(...);
  769. >        if (aH == NIL)
  770. >            return;
  771. >        AddResource(aH, TYPE, baseID, NAME);
  772. >    }
  773.  
  774. You might want to build this handle before toasting the old Prefs.
  775. In general, I'd say it's bad form to nuke the old prefs and then be
  776. unable to write out the new prefs because you were unable to allocate
  777. space for the new prefs handle.
  778. >    
  779. >/* update resource */
  780. >    if (ResError() == noErr)
  781. >    {
  782. >        HLock(aH);
  783. >        ... fill handle ...
  784. >        HUnlock(aH);
  785. >            
  786. >        ChangedResource(aH);
  787. >        WriteResource(aH);
  788. >    }
  789.  
  790. >    ReleaseResource(aH); /* or DisposeHandle or Both? */
  791.  
  792. Just use release resource.
  793.  
  794. >    UseResFile(tmpResFile);
  795. >    CloseResFile(resFile);
  796.  
  797. Your UseResFiles are a little mixed up. The only reason you'd need to do
  798. the tempResFile bit at top is if the prefs res file was open in the first
  799. place (if it's closed it'd become the current resFile when you open it,
  800. so there would be no need to do UseResFile). If it was already open,
  801. however, then you probably don't want to close it on exit.
  802.  
  803. Finally, it is also possible to do the following:
  804.     Open the prefs file
  805.     SetResLoad(false)
  806.     prefH = Get1Resource(prefs)
  807.     SetResLoad(true)
  808.     if (!prefH) {
  809.         newlyAdded = true;
  810.         prefH = NewHandle()
  811.         if (!prefH) return(MemError())
  812.         AddResource(prefH, etc)
  813.     } else newlyAdded = false;
  814.     LoadResource(prefH)
  815.     if (StripAddress(*prefH)) {
  816.         fillPrefsHandle(prefH)
  817.         ChangedResource(prefH)
  818.         WriteResource(prefH)
  819.     } else {
  820.         RemoveResource(prefH)
  821.         DisposHandle(prefH)
  822.     }
  823.  
  824. Something like this would modify the prefs handle already in the resource
  825. map. It seems a little cleaner, IMHO.
  826.  
  827. Hope this helps,
  828.  
  829. - -Ivan
  830. - -----
  831. Ivan Cavero Belaunde (ivanski@world.std.com)
  832. DiVA Corporation
  833.  
  834. ---------------------------
  835.  
  836. From: tonym@polari.online.com
  837. Subject: Forcing TextEdit to set scrpAscent and scrpHeight
  838. Organization: Seattle Online Public Access Unix.  (206) 328-4944 (all lines telebit-equipped)
  839. Date: Sun, 11 Oct 1992 01:32:21 GMT
  840.  
  841. I am writing a Windows version of a Mac application. It uses the same file
  842. format as the Mac version. This file format uses style scrap records to 
  843. store information about the text styles. So on the Windows end, I have to
  844. generate scrap style records myself without the help of TextEdit. The
  845. problem is setting the scrpHeight and scrpAscent fields properly. Since
  846. I have no way of obtaining font metrics, it seems like I am stuck. My
  847. question is this: is there some "magic" value for these fields that will
  848. force text edit to read the font metrics and fill them in properly? I
  849. tried -1, but this did not do it.
  850.  
  851. If there is no magic value, I will have to modify the Mac program to
  852. get it to reread the font metrics if the file is coming from Windows.
  853. What is the easiest way to get TextEdit to do this? Interestingly
  854. enough, TESetSelect rereads these fields, but this seems like the
  855. wrong function for this purpose.
  856.  
  857. If you have any answers or ideas, I would be much obliged. If you can figure
  858. out a method that does not require any changes on the Mac end, I will mention
  859. your name in the "Special Thanks To..." section of the manual! :-)
  860.  
  861. - -- 
  862. Tony Mann
  863. Spontaneous Software
  864.  
  865. +++++++++++++++++++++++++++
  866.  
  867. Date: 13 Oct 92 09:53:34 GMT
  868. Organization: Royal Institute of Technology, Stockholm, Sweden
  869.  
  870. > tonym@polari.online.com writes:
  871.  
  872.    I am writing a Windows version of a Mac application. It uses the same file
  873.  
  874. Gee, aren't we all? :-)
  875.  
  876.    format as the Mac version. This file format uses style scrap records to 
  877.    store information about the text styles. So on the Windows end, I have to
  878.  
  879. Sorry, but style scrap records are WHOLLY INSUITABLE for temporary
  880. storage, since it refers to fints by number. Font numbers change
  881. between machines, and even ON machines sometimes. Store font info
  882. by name. When you do this, you'll see that the other things you
  883. do will fall out naturally.
  884.  
  885. You might also want to set up a mapping from windows/mac fonts; so
  886. the user can choose to substitute appropriate fonts from platform
  887. to platform.
  888.  
  889. - -- 
  890.  -- Jon W{tte, h+@nada.kth.se, Mac Hacker Suedoise (not french speaking) --
  891.  
  892.    There's no problem that can't be solved using brute-force algorithms
  893.    and a sufficiently fast computer. Ergo, buy more hardware.
  894.  
  895. +++++++++++++++++++++++++++
  896.  
  897. From: de19@umail.umd.edu (Dana S Emery)
  898. Date: 15 Oct 92 11:02:29 GMT
  899. Organization: Personal
  900.  
  901. In article <D88-JWA.92Oct13105334@byse.nada.kth.se>,
  902. d88-jwa@byse.nada.kth.se (Jon Wtte) wrote:
  903. > Sorry, but style scrap records are WHOLLY INSUITABLE for temporary
  904. > storage, since it refers to fints by number. Font numbers change
  905. > between machines, and even ON machines sometimes. Store font info
  906. > by name. When you do this, you'll see that the other things you
  907. > do will fall out naturally.
  908.  
  909.  
  910. isn't that a bit draconian?  I agree that no code should depend on fond ID
  911. info, but I would use the style scrap record plus a font name table with
  912. the fond id as key, and the font baseline/ascent/descent info as well.
  913.  
  914. Defering the fondID resolution to the reader seems a nicely conservative
  915. approach.
  916.  
  917. Readout would involve a resolution of the (possibly) different id's, and
  918. haveing them available helps to clarify not just ID collision resolutions,
  919. but also diferent font/same name/different ID confusions.  (Too bad so many
  920. utilitys "protect" the user from such "confusing" information.)  I would
  921. compare the fontname saved to the fontname available for the saved ID, and
  922. ask the user for a substitute when things dont check out.  Noisy? yes, but
  923. I (as a user) like things that way.
  924.  
  925. 's too bad that TE doesn't handle -1 in those fields, I was hopeing for
  926. that to be true for a presently backburnured project.  :-(
  927.  
  928. - --
  929.  
  930. Dana S Emery <de19@umail.umd.edu> | "Novo, de Novo,
  931.                                   |     de novo, de no-o-o-o-o---, 
  932.                                   | Novemba come an' dey gonna go home."
  933.  
  934. ---------------------------
  935.  
  936. From: kjh+@cs.cmu.edu (Kenneth Hughes)
  937. Subject: Forcing Sys6 on a Q700?
  938. Date: 14 Oct 92 04:53:58 GMT
  939. Organization: School of Computer Science, Carnegie Mellon
  940.  
  941. Anyone know the inside technical details as to why a Q700 (or any other
  942. System-7-only platform) cannot run System 6.0.x ?  I'm wondering how feasible
  943. it'd be to hack something up so that I can test and debug some code under
  944. System 6 without having to pick up another Mac besides my Q700.
  945.  
  946. Along those lines, does anyone know the current break-down of System 7 vs
  947. System 6 users?  Has it passed 50/50 yet?  Thanks for any info.
  948.  
  949. Kenneth J. Hughes     (kjh@cs.cmu.edu)
  950.  
  951. +++++++++++++++++++++++++++
  952.  
  953. From: bredell@tdb.uu.se (Mats Bredell)
  954. Organization: Uppsala University Computing Center (UDAC)
  955. Date: Thu, 15 Oct 1992 08:12:27 GMT
  956.  
  957. Kenneth Hughes (kjh+@cs.cmu.edu) wrote:
  958. : Anyone know the inside technical details as to why a Q700 (or any other
  959. : System-7-only platform) cannot run System 6.0.x ?  I'm wondering how feasible
  960. : it'd be to hack something up so that I can test and debug some code under
  961. : System 6 without having to pick up another Mac besides my Q700.
  962. : Along those lines, does anyone know the current break-down of System 7 vs
  963. : System 6 users?  Has it passed 50/50 yet?  Thanks for any info.
  964.  
  965. There's a version of system 6 that works on the PowerBooks. I think this also
  966. works on the Quadras. The version is called 6.0.8L.
  967.  
  968. /Mats
  969. - -- 
  970. Mats Bredell                                   Mats.Bredell@udac.uu.se
  971. Uppsala University Computing Center (UDAC)     Ph:  +46 18 187817
  972. Department of medical systems                  Fax: +46 18 187825
  973. Sweden                                         Think straight - be gay!
  974.  
  975. +++++++++++++++++++++++++++
  976.  
  977. From: kjh+@cs.cmu.edu (Kenneth Hughes)
  978. Date: 15 Oct 92 20:10:25 GMT
  979. Organization: School of Computer Science, Carnegie Mellon
  980.  
  981. Here's a summary of the responses I received on this topic:
  982.  
  983. Since 7.0.1 has ROM bug fixes for the Quadras (that of course are missing
  984. in System 6 since the Quadra's came out after the last version of System 6
  985. had been released), it would not really be feasible to attempt to hack
  986. something to make System 6 run on the Quadras.
  987.  
  988. Mats.Bredell@udac.uu.se wrote:
  989. > There's a version of system 6 that works on the PowerBooks. I think this also
  990. > works on the Quadras. The version is called 6.0.8L.
  991.  
  992. According the the 10-5-92 article in MacWEEK:
  993. "The new-found system is labeld 6.0.8L.  It supports a limiteed set of Macs:
  994. the PowerBook 100, the LC, LC II, Classic and Classic II.  Other models, such
  995. as the Mac II, IIcx and IIci, are not supported at all."
  996.     I didn't see anywhere else any mention of Quadra support.  If it's in
  997. there (which I doubt) I'd love to hear about it.
  998.     They do later refer to an "acute " desire for System 6, however.  
  999. This in fact had prompted my other question regarding what fraction of users
  1000. still use System 6.  I didn't get any numbers on this, but one respondent
  1001. pointed out that he thought the System 6 hold-outs were probably much less
  1002. likely to be buying software.  I'd love to get some real numbers on this if
  1003. any developer has any info to share.
  1004.     Thanks especially to Jon W{tte and Larry Rosenstein for their comments.
  1005.  
  1006. Kenneth J. Hughes     (kjh@cs.cmu.edu)
  1007. Entelechy Corporation
  1008.  
  1009. +++++++++++++++++++++++++++
  1010.  
  1011. From: k044477@hobbes.kzoo.edu (Jamie R. McCarthy)
  1012. Date: 15 Oct 92 21:24:31 GMT
  1013. Organization: Kalamazoo College
  1014.  
  1015. kjh+@cs.cmu.edu (Kenneth Hughes) writes:
  1016. >
  1017. >...one respondent
  1018. >pointed out that he thought the System 6 hold-outs were probably much less
  1019. >likely to be buying software.  I'd love to get some real numbers on this if
  1020. >any developer has any info to share.
  1021.  
  1022. No numbers, but the other day I did see a bumper sticker that read
  1023. "I'm pro-System-6...and I purchase!"
  1024. - -- 
  1025.  Jamie McCarthy      Internet: k044477@kzoo.edu      AppleLink: j.mccarthy
  1026.  I suppose ya don't think I was run over by a streetcar!
  1027.  
  1028. ---------------------------
  1029.  
  1030. End of C.S.M.P. Digest
  1031. **********************
  1032.